$(".jedate-ymdhms").jeDate({
    isinitVal:false,
    festival: true,
    format: 'YYYY-MM-DD hh:mm:ss'
});
$(".jedate-ymdhm").jeDate({
	isinitVal:false,
	festival: true,
	format: 'YYYY-MM-DD hh:mm'
});
$(".jedate-ymdh").jeDate({
	isinitVal:false,
	festival: true,
	format: 'YYYY-MM-DD hh'
});
$(".jedate-ymd").jeDate({
	isinitVal:false,
	festival: true,
	format: 'YYYY-MM-DD'
});
$(".jedate-ym").jeDate({
	isinitVal:false,
	festival: true,
	format: 'YYYY-MM'
});
$(".jedate-y").jeDate({
	isinitVal:false,
	festival: true,
	format: 'YYYY'
});
	

function checkIsValidDate(sControlName,sControlValue) {
    if(sControlValue == "")
        return true;
    var pattern = /^((\d{4})|(\d{2}))-(\d{1,2})-(\d{1,2})$/g;
    if(!pattern.test(sControlValue)){
        alert(sMessage+"的格式不合法(yyyy-MM-dd)！");
        return false;
    }    
    var arrDate = sControlValue.split("-");
    if(parseInt(arrDate[0],10) < 100)
        arrDate[0] = 2000 + parseInt(arrDate[0],10) + "";
    var date =  new Date(arrDate[0],(parseInt(arrDate[1],10) -1)+"",arrDate[2]);
    if (parseInt(arrDate[1],10)>12 && parseInt(arrDate[1],10)>0){
    	alert(sMessage+"的月份不能大于12");
        return false;
    }else if ((parseInt(arrDate[1],10)==1 || parseInt(arrDate[1],10)==3 || parseInt(arrDate[1],10)==5 || parseInt(arrDate[1],10)==7 || parseInt(arrDate[1],10)==8 || parseInt(arrDate[1],10)==10 || parseInt(arrDate[1],10)==12) && parseInt(arrDate[1],10)>0){
		if (parseInt(arrDate[2],10)>31 && parseInt(arrDate[2],10)>0){
			alert(sMessage+"的值错误"+arrDate[0]+"年"+arrDate[1]+"月的天数不能大于31"); 
        	return false;
    	}
	}else if ((parseInt(arrDate[1],10)==4 || parseInt(arrDate[1],10)==6 || parseInt(arrDate[1],10)==9 || parseInt(arrDate[1],10)==11) && parseInt(arrDate[1],10)>0){
		if (parseInt(arrDate[2])>30 && parseInt(arrDate[2],10)>0){
			alert(sMessage+"的值错误"+arrDate[0]+"年"+arrDate[1]+"月的天数不能大于30"); 
        	return false;
    	}
	}else if (parseInt(arrDate[1],10)==2 && parseInt(arrDate[1],10)>0){ 
		if (checkLeapYear(arrDate[0]) && parseInt(arrDate[2],10)>29 && parseInt(arrDate[2],10)>0){
			alert(sMessage+"的值错误"+arrDate[0]+"年"+arrDate[1]+"月的天数不能大于29");
			return false;
		}
		if (!checkLeapYear(arrDate[0]) && parseInt(arrDate[2],10)>28 && parseInt(arrDate[2],10)>0){
			alert(sMessage+"的值错误"+arrDate[0]+"年"+arrDate[1]+"月的天数不能大于28");
			return false;
		}
	}else if (date.getYear() == arrDate[0] && date.getMonth() == (parseInt(arrDate[1],10) -1)+"" && date.getDate() == arrDate[2]){
        return true;
    }else{
    	alert(sMessage+"的格式不合法(yyyy-MM-dd)！");
		return false;
	}
	return true;	 	    
}
function checkTwoDateEarlier(strStart,strEnd)
{	
	strStart = $("#"+strStart).val(); 
	strEnd = $("#"+strEnd).val();
    if (( strStart == "" ) || ( strEnd == "" ))
        return true;
    var str1 = "";
    var str2 = "";
	for(var i=0; i<3; i++){
		if(checkIsInteger(strStart[i])){
			str1 = str + strStart[i];
		}
		if(checkIsInteger(strEnd[i])){
			str2 = str + strEnd[i];
		}
	}	
	
    var arr1 = strStart.split("-");
    var arr2 = strEnd.split("-");
    var date1 = new Date(arr1[0],parseInt(arr1[1].replace(/^0/,""),10) - 1,arr1[2]);
    var date2 = new Date(arr2[0],parseInt(arr2[1].replace(/^0/,""),10) - 1,arr2[2]);
    if(arr1[1].length == 1)
        arr1[1] = "0" + arr1[1];
    if(arr1[2].length == 1)
        arr1[2] = "0" + arr1[2];
    if(arr2[1].length == 1)
        arr2[1] = "0" + arr2[1];
    if(arr2[2].length == 1)
        arr2[2]="0" + arr2[2];
    var d1 = arr1[0] + arr1[1] + arr1[2];
    var d2 = arr2[0] + arr2[1] + arr2[2];
    if(parseInt(d1,10) > parseInt(d2,10))
       return false;
    else
       return true;
}

function checkDateEarlier(strStart,strEnd)
{
   
    if (( strStart == "" ) || ( strEnd == "" ))
        return true;
    var arr1 = strStart.split("-");
    var arr2 = strEnd.split("-");
    var date1 = new Date(arr1[0],parseInt(arr1[1].replace(/^0/,""),10) - 1,arr1[2]);
    var date2 = new Date(arr2[0],parseInt(arr2[1].replace(/^0/,""),10) - 1,arr2[2]);
    if(arr1[1].length == 1)
        arr1[1] = "0" + arr1[1];
    if(arr1[2].length == 1)
        arr1[2] = "0" + arr1[2];
    if(arr2[1].length == 1)
        arr2[1] = "0" + arr2[1];
    if(arr2[2].length == 1)
        arr2[2]="0" + arr2[2];
    var d1 = arr1[0] + arr1[1] + arr1[2];
    var d2 = arr2[0] + arr2[1] + arr2[2];
    if(parseInt(d1,10) > parseInt(d2,10))
       return false;
    else
       return true;
}

function checkDateEarlier(start,startName,end,endName,type)
{
	var strStart = $("#"+start).val(); 
	var strEnd = $("#"+end).val();
	
	
    if (( strStart == "" ) || ( strEnd == "" ))
        return true;
    
    var date1;
    var date2;
    
    if(type=="DATE"){ 
    	var arr1 = strStart.split("-");
    	var arr2 = strEnd.split("-");
    	
    	date1 = new Date(arr1[0],parseInt(arr1[1].replace(/^0/,""),10) - 1,arr1[2]);
    	date2 = new Date(arr2[0],parseInt(arr2[1].replace(/^0/,""),10) - 1,arr2[2]);
    	
    }else if(type=="DATETIME"){ 
	    var arr1 = strStart.split(" ");
	    var arr11 = arr1[0].split("-");
	    var arr12 = arr1[1].split(":");
	    
	    var arr2 = strEnd.split(" ");
	    var arr21 = arr2[0].split("-");
	    var arr22 = arr2[1].split(":");
	    
	    date1 = new Date(arr11[0],parseInt(arr11[1].replace(/^0/,""),10) - 1,arr11[2],arr12[0],parseInt(arr12[1].replace(/^0/,""),10) - 1,arr12[2]);
	    date2 = new Date(arr21[0],parseInt(arr21[1].replace(/^0/,""),10) - 1,arr21[2],arr22[0],parseInt(arr22[1].replace(/^0/,""),10) - 1,arr22[2]);
    }else if(type=="DateAndDatetime"){ 
    	var arr11 = strStart.split("-");
    	var time="00:00:00";
	    var arr12 = time.split(":");
	    
	    var arr2 = strEnd.split(" ");
	    var arr21 = arr2[0].split("-");
	    var arr22 = arr2[1].split(":");
	    
	    date1 = new Date(arr11[0],parseInt(arr11[1].replace(/^0/,""),10) - 1,arr11[2],arr12[0],parseInt(arr12[1].replace(/^0/,""),10) - 1,arr12[2]);
	    date2 = new Date(arr21[0],parseInt(arr21[1].replace(/^0/,""),10) - 1,arr21[2],arr22[0],parseInt(arr22[1].replace(/^0/,""),10) - 1,arr22[2]);
    }else if(type=="DatetimeAndDate"){ 
	    var arr1 = strStart.split(" ");
	    var arr11 = arr1[0].split("-");
	    var arr12 = arr1[1].split(":");
	    
	    var arr21 = strEnd.split("-");
	    var time="23:59:59";
		var arr22 = time.split(":");
	    
	    date1 = new Date(arr11[0],parseInt(arr11[1].replace(/^0/,""),10) - 1,arr11[2],arr12[0],parseInt(arr12[1].replace(/^0/,""),10) - 1,arr12[2]);
	    date2 = new Date(arr21[0],parseInt(arr21[1].replace(/^0/,""),10) - 1,arr21[2],arr22[0],parseInt(arr22[1].replace(/^0/,""),10) - 1,arr22[2]);
    }
    
    if(date1>date2){
    	alert(startName + "不能大于" + endName,"提示信息");
       	return false;
       }
    else
       return true;
}
function dateTimeCompare(startTimeId,endTimeId,str){
	var sj1= $("#"+startTimeId).val();
	var sj2= $("#"+endTimeId).val();
	if(sj1!=null && sj1!="" && sj2!=null && sj2!=""){
		if(sj1>sj2){
			alert(str+"范围不正确");
			return false;
		}else{
			return true;
		}
	}else{
		return true;
	}
}
function checkEmail(str) {
    if(str == "")
        return true;
    if (str.charAt(0) == "." || str.charAt(0) == "@" || str.indexOf('@', 0) == -1
        || str.indexOf('.', 0) == -1 || str.lastIndexOf("@") == str.length-1 || str.lastIndexOf(".") == str.length-1)
        return false;
    else
        return true;
}
function checkIsChinese(str) {
    if (str == "")
        return true;
    var pattern = /^([\u4E00-\u9FA5]|[\uFE30-\uFFA0])*$/gi;
    if (pattern.test(str))
        return true;
    else
        return false;
}

/**
 * 根据传入的正则来进行匹配
 * @param str
 * @param pat
 * @returns
 */
function checkMask(str,pat) {
    if (str == "")
        return true;
    var pattern = new RegExp(pat,"gi")
    if (pattern.test(str))
        return true;
    else
        return false;
}
/**
 * 检测非法字符
 * @param str
 * @returns
 */
function checkSpecil(str) {
    if (str == "")
        return true;
    var pattern = "/^[^@\/\'\\\"#$%&\^\*]+$/";
    if (pattern.test(str))
        return false;
    else
        return true;
}

/**
 * 验证字符串是否不为空
 */
function isNotNull(str) {
	if(str == null || str == "" || str.trim().length == 0){
		return false;
	}
	return true;
}
/**
 * 验证字符串是否为空
 * @param str
 * @returns
 */
function isNull(str) {
	return !isNotNull(str);
}
	
/**
 * 闰年
 * @param sYear
 * @returns
 */
function checkLeapYear(sYear){
	if (((sYear%4==0)&&(sYear%100!=0))||(sYear%400))
		return true;
	else
		return false;
}

/**
 * 复选框是否被选中
 * @param obj
 * @returns
 */
function isChecked(obj){
	if (obj==null){ 
  		return false;
  	}	
  	if (obj.length==null){
  		if (obj.checked == true)
  			return true;
  		else 
  			return false;
  	}
  	for (i=0;i < obj.length;i++){
  		if (obj[i].checked == true)
  			return true;
  	}
  	return false;
}

/**
 * 人民币转换
 * @param currencyDigits
 * @returns
 */
function convertCurrency(currencyDigits) {

	var MAXIMUM_NUMBER = 99999999999.99;
	
	var CN_ZERO = "零";
	var CN_ONE = "壹";
	var CN_TWO = "贰";
	var CN_THREE = "叁";
	var CN_FOUR = "肆";
	var CN_FIVE = "伍";
	var CN_SIX = "陆";
	var CN_SEVEN = "柒";
	var CN_EIGHT = "捌";
	var CN_NINE = "玖";
	var CN_TEN = "拾";
	var CN_HUNDRED = "佰";
	var CN_THOUSAND = "仟";
	var CN_TEN_THOUSAND = "万";
	var CN_HUNDRED_MILLION = "亿";
	var CN_SYMBOL = "人民币";
	var CN_DOLLAR = "元";
	var CN_TEN_CENT = "角";
	var CN_CENT = "分";
	var CN_INTEGER = "整";
	
	
	var integral; 
	var decimal; 
	var outputCharacters; 
	var parts;
	var digits, radices, bigRadices, decimals;
	var zeroCount;
	var i, p, d;
	var quotient, modulus;


	currencyDigits = currencyDigits.toString();
	if (currencyDigits == "") {
		alert("Empty input!");
		return "";
	}
	if (currencyDigits.match(/[^,.\d]/) != null) {
		alert("Invalid characters in the input string!");
		return "";
	}
	if ((currencyDigits).match(/^((\d{1,3}(,\d{3})*(.((\d{3},)*\d{1,3}))?)|(\d+(.\d+)?))$/) == null) {
		alert("Illegal format of digit number!");
		return "";
	}


	currencyDigits = currencyDigits.replace(/,/g, "");
	currencyDigits = currencyDigits.replace(/^0+/, ""); 
	if (Number(currencyDigits) > MAXIMUM_NUMBER) {
		alert("Too large a number to convert!");
		return "";
	}

	parts = currencyDigits.split(".");
	if (parts.length > 1) {
		integral = parts[0];
		decimal = parts[1];
		decimal = decimal.substr(0, 2);
	} else {
		integral = parts[0];
		decimal = "";
	}
	digits = new Array(CN_ZERO, CN_ONE, CN_TWO, CN_THREE, CN_FOUR, CN_FIVE, CN_SIX, CN_SEVEN, CN_EIGHT, CN_NINE);
	radices = new Array("", CN_TEN, CN_HUNDRED, CN_THOUSAND);
	bigRadices = new Array("", CN_TEN_THOUSAND, CN_HUNDRED_MILLION);
	decimals = new Array(CN_TEN_CENT, CN_CENT);
	outputCharacters = "";
	if (Number(integral) > 0) {
		zeroCount = 0;
		for (i = 0; i < integral.length; i++) {
			p = integral.length - i - 1;
			d = integral.substr(i, 1);
			quotient = p / 4;
			modulus = p % 4;
			if (d == "0") {
				zeroCount++;
			} else {
				if (zeroCount > 0) {
					outputCharacters += digits[0];
				}
				zeroCount = 0;
				outputCharacters += digits[Number(d)] + radices[modulus];
			}
			if (modulus == 0 && zeroCount < 4) {
				outputCharacters += bigRadices[quotient];
			}
		}
		outputCharacters += CN_DOLLAR;
	}
	// Process decimal part if there is:
	if (decimal != "") {
		for (i = 0; i < decimal.length; i++) {
			d = decimal.substr(i, 1);
			if (d != "0") {
				outputCharacters += digits[Number(d)] + decimals[i];
			}
		}
	}
	if (outputCharacters == "") {
		outputCharacters = CN_ZERO + CN_DOLLAR;
	}
	if (decimal == "") {
		outputCharacters += CN_INTEGER;
	}
	outputCharacters = outputCharacters;
	return outputCharacters;
}

/**
 * 字符转义
 * @param obj
 * @returns
 */
function changeTsZifu(obj){ 
	obj=''+obj;
	obj=obj.replace(/(&nbsp;)/g,''); 
	if(obj.indexOf("&gt;")==-1 && obj.indexOf("&lt;")==-1){
		obj=obj.replace(/(&)/g,'&amp;'); 
	}
	obj=obj.replace(/(<)/g,'&lt;'); 
	obj=obj.replace(/(>)/g,'&gt;'); 
	obj=obj.replace(/(\')/g,'&apos;');
	obj=obj.replace(/(\")/g,'&quot;');
	return obj;
}
function getId(begin_id,id_name){
	return id_name.substring(begin_id.length,id_name.length);
}
/**
 * 获取形如begin_id开头的所有ID的json串
 * @param begin_id
 * @returns
 */
function getAllValue(begin_id){
	var id_data="[{";
	if(valideData(begin_id)){
		id_data = id_data + begin_id;
	}else{
		$("input:text").each(function(){
			var id_name_text = $(this).attr("id");
			if(valideId(begin_id,id_name_text)){
				if(this.value!=""&&this.value!=null){
					id_data = id_data + getId(begin_id,id_name_text) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
				}
			}
		});
		$("input:hidden").each(function(){
			var id_name_text = $(this).attr("id");
			if(valideId(begin_id,id_name_text)){
				if(this.value!=""&&this.value!=null){
					id_data = id_data + getId(begin_id,id_name_text) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
				}
			}
		});
		$("textarea").each(function(){
			var id_name_text = $(this).attr("id");
			if(valideId(begin_id,id_name_text)){
				id_data = id_data + getId(begin_id,id_name_text) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
			}
		});
		$("input:radio").each(function(){
			var id_name_radio = $(this).attr("id");
			if(valideId(begin_id,id_name_radio)){
				if($(this).attr("checked")){ 
					id_data = id_data + getId(begin_id,id_name_radio) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
				}					
			}
		});
		$("select").each(function(){
			var id_name_select = $(this).attr("id");
			if(valideId(begin_id,id_name_select)){
				var value = $(this).find("option:selected").val();
				id_data = id_data + getId(begin_id,id_name_select) + ":'" + value +"',";
			}
		});
		if(id_data!="[{"){
			id_data = id_data.substring(0,id_data.length-1)
		}
	}
	id_data = id_data + "}]";
	//替换特殊字符
//	id_data = id_data.replace(new RegExp(/<(no)?script[^>]*>.*?<\/(no)?script>/),"");
	id_data = id_data.replace(new RegExp(/</g),"&lt;");
	id_data = id_data.replace(new RegExp(/>/g),"&gt;");
	id_data = id_data.replace(new RegExp(/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/g),"\"\"");
	return $.toJSON(id_data);
}

function valideId(begin_id,id_name){
	if(begin_id!=null && begin_id!='' && id_name!=null && id_name!="" && id_name.indexOf(begin_id)==0){
		return true;
	}else{
		return false;
	}
}
function valideData(begin_id){
	if(begin_id==null || begin_id=="" || begin_id.indexOf(":")>=0){
		return true;
	}else{
		return false;
	}
}
function getId(begin_id,id_name){
	return id_name.substring(begin_id.length,id_name.length);
}

/**
 * 自定义ajax请求 公共函数
 * 
 * @param value       传入后台的参数值
 * @param url         请求地址
 * @param requestType 请求方式，GET、POST
 * @param ajaxType    AJAX类型，true代表异步，false代表同步
 * @param resultType  返回类型
 * @param callback    回调函数
 * @param obj         一个你可能要在回调后对其进行操作的参数
 * @return
 */
function ajaxCustomRequest(value, url, requestType, ajaxType, resultType, callback, obj) {
	value = value.replace(new RegExp(/</g),"&lt;");
	value = value.replace(new RegExp(/>/g),"&gt;");
	value = value.replace(new RegExp(/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/g),"\"\"");
	value = JSON.stringify(value);
	jQuery.ajax({
		type : requestType,
		async: ajaxType,
		contentType : 'application/json',
		url : ctx + url + ".html",
		data : value,
		dataType : resultType,
		success : function(data) {
			if ("session-invalidate" == data) {
				window.top.location.href = ctx + "/logout.html";
			}
			callback(data, obj);
		},
		error : function(data) {
			if ("session-invalidate" == data.responseText) {
				url = getRedirectUrl(url);
				window.top.location.href = ctx + "/logout.html";
			}else {
				alert("服务器发生异常,这个错误出现在：" + url + "这个链接上.");
			}
			callback('', obj);
		}
	 });
}
/**
 * 异步ajax请求 公共函数
 * 
 * @param value       传入后台的参数值
 * @param url         请求地址
 * @param requestType 请求方式，GET、POST
 * @param resultType  返回类型
 * @param callback    回调函数
 * @param obj         一个你可能要在回调后对其进行操作的参数
 * @return
 */
function ajaxAsyncRequest(value, url, requestType, resultType, callback, obj) {
	ajaxCustomRequest(value, url, requestType, true, resultType, callback, obj);
}
/**
 * 同步ajax请求 公共函数
 * 
 * @param value       传入后台的参数值
 * @param url         请求地址
 * @param requestType 请求方式，GET、POST
 * @param resultType  返回类型
 * @param callback    回调函数
 * @param obj         一个你可能要在回调后对其进行操作的参数
 * @return
 */
function ajaxSynchRequest(value, url, requestType, resultType, callback, obj) {
	ajaxCustomRequest(value, url, requestType, false, resultType, callback, obj);
}

function checkAlpha(str){
  return str.match(/^[a-zA-Z]*$/);
}
function checkWord(str){
  return str.match(/^[0-9a-zA-Z_]*$/);
}

/**
 * 验证电话格式是否正确
 * @param {Object} phone 验证的电话号码
 * @param {Object} checkName 验证的名称
 */
function checkPhone(phone,checkName) {
	var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
	var isMob = /^((\+?86)|(\(\+86\)))?(13[012356789][0-9]{8}|15[012356789][0-9]{8}|18[02356789][0-9]{8}|147[0-9]{8}|1349[0-9]{7})$/;
	if(isMob.test(phone) || isPhone.test(phone)){
	    return true;
	}
	alert(checkName+"格式不对!");
	return false;
}




//************阿拉伯数字转中文汉字**************
var _change = {
    ary0:["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
    ary1:["", "十", "百", "千"],
    ary2:["", "万", "亿", "兆"],
    init:function (name) {
        this.name = name;
    },
    strrev:function () {
        var ary = []
        for (var i = this.name.length; i >= 0; i--) {
            ary.push(this.name[i])
        }
        return ary.join("");
    }, //倒转字符串。
    pri_ary:function () {
        var $this = this
        var ary = this.strrev();
        var zero = ""
        var newary = ""
        var i4 = -1
        for (var i = 0; i < ary.length; i++) {
            if (i % 4 == 0) { //首先判断万级单位，每隔四个字符就让万级单位数组索引号递增
                i4++;
                newary = this.ary2[i4] + newary; //将万级单位存入该字符的读法中去，它肯定是放在当前字符读法的末尾，所以首先将它叠加入$r中，
                zero = ""; //在万级单位位置的“0”肯定是不用的读的，所以设置零的读法为空

            }
            //关于0的处理与判断。
            if (ary[i] == '0') { //如果读出的字符是“0”，执行如下判断这个“0”是否读作“零”
                switch (i % 4) {
                    case 0:
                        break;
                    //如果位置索引能被4整除，表示它所处位置是万级单位位置，这个位置的0的读法在前面就已经设置好了，所以这里直接跳过
                    case 1:
                    case 2:
                    case 3:
                        if (ary[i - 1] != '0') {
                            zero = "零"
                        }
                        ; //如果不被4整除，那么都执行这段判断代码：如果它的下一位数字（针对当前字符串来说是上一个字符，因为之前执行了反转）也是0，那么跳过，否则读作“零”
                        break;

                }

                newary = zero + newary;
                zero = '';
            }
            else { //如果不是“0”
                newary = this.ary0[parseInt(ary[i])] + this.ary1[i % 4] + newary; //就将该当字符转换成数值型,并作为数组ary0的索引号,以得到与之对应的中文读法，其后再跟上它的的一级单位（空、十、百还是千）最后再加上前面已存入的读法内容。
            }

        }
        if (newary.indexOf("零") == 0) {
            newary = newary.substr(1)
        }//处理前面的0
        return newary;
    }
}
 
//创建class类
function change() {
    this.init.apply(this, arguments);
}
change.prototype = _change;
//****************************************
Date.prototype.format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, //月份 
        "d+": this.getDate(), //日 
        "H+": this.getHours(), //小时 
        "m+": this.getMinutes(), //分 
        "s+": this.getSeconds(), //秒 
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
        "S": this.getMilliseconds() //毫秒 
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
//组装json数组字符串
function getJsonStr(conDiv,begin_id){
	var id_data="{";
	if(valideData(begin_id)){
		id_data = id_data + begin_id;
	}else{
		$("#"+conDiv).find("input:text").each(function(){
			var id_name_text = $(this).attr("id");
			if(valideId(begin_id,id_name_text)){
				if(this.value){
					id_data = id_data + getId(begin_id,id_name_text) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
				}
			}
		});
		$("#"+conDiv).find("input:hidden").each(function(){
			var id_name_text = $(this).attr("id");
			if(valideId(begin_id,id_name_text)){
				if(this.value){
					id_data = id_data + getId(begin_id,id_name_text) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
				}
			}
		});
		$("#"+conDiv).find("textarea").each(function(){
			var id_name_text = $(this).attr("id");
			if(valideId(begin_id,id_name_text)){
				if(this.value){
					id_data = id_data + getId(begin_id,id_name_text) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
				}
			}
		});
		$("#"+conDiv).find("input:password").each(function(){
			var id_name_password = $(this).attr("id");
			if(valideId(begin_id,id_name_password)){
				id_data = id_data + getId(begin_id,id_name_password) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
			}
		});
		$("#"+conDiv).find("input:radio").each(function(){
			var id_name_radio = $(this).attr("id");
			if(valideId(begin_id,id_name_radio)){
				if($(this).attr("checked")){ 
					id_data = id_data + getId(begin_id,id_name_radio) + ":'" +this.value.replace(new RegExp(/'/g),"\\'") +"',";
				}					
			}
		});
		$("#"+conDiv).find("select").each(function(){
			var id_name_select = $(this).attr("id");
			if(valideId(begin_id,id_name_select)){
				var value = $(this).find("option:selected").val();
				if(value){
					id_data = id_data + getId(begin_id,id_name_select) + ":'" + value +"',";
				}
			}
		});
		if(id_data!="{"){
			id_data = id_data.substring(0,id_data.length-1)
		}
	}
	id_data = id_data + "}";
	//替换特殊字符
//	id_data = id_data.replace(new RegExp(/<(no)?script[^>]*>.*?<\/(no)?script>/),"");
	id_data = id_data.replace(new RegExp(/</g),"&lt;");
	id_data = id_data.replace(new RegExp(/>/g),"&gt;");
	id_data = id_data.replace(new RegExp(/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/g),"\"\"");
	return id_data;
}

